
export function downloadFile(stream, name, suffix = '.xlsx') {
    if (stream && name) {
      const blob =  new Blob([stream], { type: 'application/vnd.ms-excel;charset=utf-8' })
      const fullName = `${name + suffix}`
      // IE10+ 浏览器特殊处理
      if (window.navigator.msSaveBlob) {
        window.navigator.msSaveBlob(blob, fullName)
      } else {
        const href = window.URL.createObjectURL(blob)
        let a = document.createElement('a')
        a.href = href
        a.download = fullName
        document.body.appendChild(a)
        a.click()
        window.URL.revokeObjectURL(href)
        document.body.removeChild(a)
      }
    }
  }
  
  